import { createApp } from "vue";
import App from "@/App.vue";
import "animate.css";
import "@/styles/index.css";
import "ys-fonts/NotoSansSC.css";
import "vfonts/FiraCode.css";
import "@/plugins/router/router";

import { createPinia } from "pinia";
import { createRouter } from "@/plugins/router";
import { createI18n } from "@/plugins/i18n/i18n";
import { loadConfigDefasult } from "@/plugins/store";
import { initWindowDebug } from "ys-ts/src/ts/log";

async function init() {
  // 初始化 logger
  initWindowDebug();

  if (import.meta.env.VITE_APP_TITLE) {
    document.title = import.meta.env.VITE_APP_TITLE;
  }

  if (import.meta.env.PROD) {
    console.log = () => {
      return;
    };
  }

  const app = createApp(App);
  app.use(createRouter());
  app.use(createPinia());
  await createI18n(["zh-CN"]).then((res) => {
    app.use(res);
  });

  await loadConfigDefasult();

  app.mount("#app");
}

init();
